package thread;

/**
 * @author DBX
 * @effect 修改下面代码的编译
 * @date 2021/09/01/20:01
 */
public class Test2 {
    public static void main(String[] args) {
		Thread t1 = new Thread() {
            @Override
            public void run() {
                Foo1.doSome();
            }
		};
		Thread t2 = new Thread() {
            @Override
            public void run() {
                Foo1.doSome();
            }
		};
		t1.start();
		t2.start();
    }
}
class Foo1{
    public static void doSome() {
		synchronized (Foo1.class) {

            try {
                Thread.sleep(5000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName()+"  hello!");
        }
    }
}

